﻿using Entity;
using System;
using System.Collections.Generic;
using System.Text;

namespace ServiceCore
{
    public class CoreStartDo
    {
        public static ResultObjModel ResultAction(Func<ResultObjModel, ResultObjModel> action)
        {
            ResultObjModel result = new ResultObjModel();
            try
            {
                result = action(result);
            }
            catch (Exception ex)
            {
                result.code = 1;
                result.msg = ex.ToString();
            }
            return result;
        }
        public static T ResultAction<T>(Func<T, T> action) where T : ResultModel, new()
        {
            T result = new T();
            try
            {
                result = action(result);
            }
            catch (Exception ex)
            {
                result.code = 1;
                result.msg = ex.Message;
            }
            return result;
        }
    }
    public class ResultModel
    {
        public int code { get; set; }

        public string msg { get; set; }

        public DateTime SendData { get; set; } = DateTime.Now;
    }
    public class ResultObjModel : ResultModel
    {
        public object data { get; set; }
    }
    public class ResultObjExtModel : ResultModel
    {
        public object data { get; set; }

        public object Ext { get; set; }
    }
    public class ResultTModel<T> : ResultModel
    {
        public T data { get; set; }
    }
    public class ResultObjModelWhitExp : ResultModel
    {
        public object data { get; set; }

        public object exp { get; set; }
    }

    public class ResultListModel : ResultModel
    {
        public int current { get; set; }
        public int total { get; set; }
        public object rows { get; set; }
    }
    public class ResultListModel<T> : ResultModel
    {
        public int current { get; set; }
        public int total { get; set; }
        public List<T> rows { get; set; }
    }

    public class ResultListModelWithObj : ResultListModel
    {
        public object exp { get; set; }
    }

    public class ResultListModelWithObj<T> : ResultListModel<T>
    {
        public object exp { get; set; }
    }

    public class Base_List_Params
    {

        public bool Issale { get; set; } = false;
        public string SerchKeyword { get; set; } = "";
        /// <summary>
        /// 是否需要分页
        /// </summary>
        public bool? IsPage { get; set; } = true;
        /// <summary>
        ///  当前页数
        /// </summary>
        public int? page { get; set; } = 1;
        /// <summary>
        /// 单页数量
        /// </summary>

        public int? pagesize { get; set; } = 10;
    }

    public class order_search_pagelist_Params
    {
        public string order_id { get; set; }

        public string TradeNo { get; set; }
    }
    public class Base_PageList_Params
    {
        /// <summary>
        /// 开始时间
        /// </summary>
        public string Sdt { get; set; }
        /// <summary>
        /// 结束时间
        /// </summary>
        public string Edt { get; set; }
        public string SerchKeyword { get; set; }
        /// <summary>
        /// 是否需要分页
        /// </summary>
        public bool? IsPage { get; set; }
        /// <summary>
        ///  当前页数
        /// </summary>
        public int? page { get; set; }
        /// <summary>
        /// 单页数量
        /// </summary>

        public int? pagesize { get; set; }
    }
    /// <summary>
    /// 
    /// </summary>
    public class search_customer_list : Base_List_Params
    {
        /// <summary>
        /// 搜索类型
        /// </summary>
        public search_enum_type? search_type { get; set; }
        /// <summary>
        /// 搜索值
        /// </summary>
        public string search_value { get; set; }

        public string sn { get; set; }
        /// <summary>
        /// 售后名字
        /// </summary>
        public string customer_uname { get; set; }
    }
    public enum search_enum_type
    {
        客户姓名 = 0,
        客户电话 = 1,
        客户微信号 = 2,
        客户账号 = 3
    }


    public class search_my_repair_list : Base_List_Params
    {
        /// <summary>
        /// 搜索类型
        /// </summary>
        public search_enum_type? search_type { get; set; }
        /// <summary>
        /// 搜索值
        /// </summary>
        public string search_value { get; set; }

        /// <summary>
        /// 售后ID
        /// </summary>
        public string customer_uid { get; set; }
        /// <summary>
        /// 机器类型
        /// </summary>
        public string mch_type { get; set; }
        /// <summary>
        /// 机器SN
        /// </summary>
        public string mch_sn { get; set; }
        /// <summary>
        /// 报修类型
        /// </summary>
        public string repair_type { get; set; }
        /// <summary>
        /// 报修小类型
        /// </summary>
        public string repair_kid_type { get; set; }
        /// <summary>
        /// 搜索开始时间
        /// </summary>
        public string repair_sdt { get; set; }
        /// <summary>
        /// 搜索结束时间
        /// </summary>
        public string repair_edt { get; set; }
        /// <summary>
        ///报修处理状态
        /// </summary>
        public int? repair_handle_state { get; set; }
        /// <summary>
        /// 寄件状态
        /// </summary>
        public express_state? express_state { get; set; }
        /// <summary>
        /// 返件状态
        /// </summary>
        public return_approval_state? return_approval_state { get; set; }
        /// <summary>
        /// 审批类型 
        /// </summary>
        public approval_model? approval_model { get; set; }

    }

    public class search_my_approval_list : Base_List_Params
    {
        /// <summary>
        /// 用户名
        /// </summary>
        public string user_name { get; set; }
        /// <summary>
        /// 提交人
        /// </summary>
        public string technology_uid { get; set; }
        /// <summary>
        /// 审批状态
        /// </summary>
        public apply_state? repair_handle_state { get; set; }

        public string addtime_sdt { get; set; }
        public string addtime_edt { get; set; }

        public string repair_approval_time_sdt { get; set; }

        public string repair_approval_time_edt { get; set; }

        public bool? have_pic { get; set; }

        public approval_model? approval_model { get; set; }
        public int? reback_state { get; set; }
        /// <summary>
        /// 快递单号查询
        /// </summary>
        public string express_no { get; set; }
        /// <summary>
        ///  寄件状态
        /// </summary>
        public express_state? express_state { get; set; }

        #region 20200907新增寄件相关条件
        /// <summary>
        /// 寄件开始时间
        /// </summary>
        public string express_time_sdt { get; set; }
        /// <summary>
        /// 寄件结束时间
        /// </summary>
        public string express_time_edt { get; set; } 
        /// <summary>
        /// 返件搜索类型
        /// </summary>
        public express_time_out_type? express_time_out_type { get; set; }
        #endregion
    }

    public enum express_time_out_type
    {
        小于等于1天 = 1,
        大于1天小于等于7天 = 2,
        大于7天小于等于15天 = 3,
        大于15天 = 4
    }
    /// <summary>
    /// 针对SIMboss的统计数据
    /// </summary>
    public class SimListPageObjList : ResultListModel
    {
        public decimal total_RK_price { get; set; }

        public decimal total_orgin_price { get; set; }
    }

    public class SimBossTotal
    {
        /// <summary>
        /// 数量
        /// </summary>
        public int Count { get; set; }
        /// <summary>
        /// RK价格
        /// </summary>
        public decimal total_RK_price { get; set; }
        /// <summary>
        /// 原始金额
        /// </summary>
        public decimal total_orgin_price { get; set; }
    }
    /// <summary>
    /// 充值订单列表
    /// </summary>
    public class Reg_ListToAdmin
    {
        /// <summary>
        /// 充值记录ID
        /// </summary>
        public string Id { get; set; }
        /// <summary>
        ///  对应订单ID 
        /// </summary>
        public string OrderNo { get; set; }
        /// <summary>
        /// IC卡号
        /// </summary>
        public string Iccid { get; set; }
        /// <summary>
        /// RatePlanName
        /// </summary>
        public string RatePlanName { get; set; }
        /// <summary>
        /// 机器名称
        /// </summary>
        public string MchName { get; set; }
        /// <summary>
        /// 用户名称
        /// </summary>
        public string UserName { get; set; }
        /// <summary>
        /// 支付状态
        /// </summary>
        public int PayState { get; set; }

        /// <summary>
        /// 订单支付状态
        /// </summary>
        public string PayState_Str { get; set; }
        /// <summary>
        ///  支付金额
        /// </summary>
        public decimal Pay_fee { get; set; }
        /// <summary>
        ///  支付类型
        /// </summary>
        public decimal Fee_TypeId { get; set; }
        /// <summary>
        /// simboss卡订单
        /// </summary>
        public string SimOrder { get; set; }
        /// <summary>
        /// simboss卡订单
        /// </summary>
        public string SimResult { get; set; }

        public string CreateOn { get; set; }

        public string BaseUserId { get; set; }
        /// <summary>
        /// simboss卡实际请求结果
        /// </summary>
        public string SimResultMsg { get; set; }
        /// <summary>
        /// simboss 原始价格
        /// </summary>
        public decimal OriginalPrice { get; set; }
    }
    public class tool_get_mch_pagelist_query : Base_List_Params
    {
        public string mch_name { get; set; }

        public string mch_id { get; set; }

        public string mch_sn { get; set; }

        public string user_name { get; set; }

        public string user_tel { get; set; }

        public string user_loginname { get; set; }
    }
    public class get_mch_pagelist_result
    {
        private MchState? Pri_State = null;

        public string State_str { get { return Pri_State.Value.ToString(); } }
        public string Id { get; set; }
        public string SN { get; set; }

        public string Key { get; set; }
        public string Name { get; set; }
        public MchState State { get { return Pri_State.HasValue ? Pri_State.Value : (MchState)100; } set { Pri_State = value; } }
        public bool IsOnLine { get; set; }
        public string MchType { get; set; }
        public DateTime? assurance_sdt { get; set; }
        public string Baseuserid { get; set; }
        public string Tel { get; set; }
        public string UserName { get; set; }
        public string u_name { get; set; }

        public List<Mchinfo> mch_info_list { get; set; }

        public string iccid { get; set; }
    }

    public class EditMch
    {
        public string Id { get; set; }
        public string Name { get; set; }

        public string SN { get; set; }

        public string MchType { get; set; }

        public MchState? State { get; set; }
        public string assurance_sdt { get; set; }
    }

    public class mch_Bind_params : Base_List_Params
    {
        public bind_type_enum? search_type { get; set; }

        public bool is_manage { get; set; } = false;
    }

    public class mch_Bind_params_for_manage : Base_List_Params
    {
        /// <summary>
        /// 根据机器ID搜索
        /// </summary>
        public string mchid { get; set; }
        /// <summary>
        /// 根据机器SN搜索
        /// </summary>
        public string sn { get; set; }
        /// <summary>
        /// 根据机器生产单搜索
        /// </summary>
        public string work_order_details_id { get; set; }
        /// <summary>
        /// 根据机器柜体码搜索
        /// </summary>
        public string box_code { get; set; }
    }

    public class admin_mch_params : Base_List_Params
    {
        public string sn { get; set; }

        public string mchid { get; set; }

        public string mchname { get; set; }

        public string baseuserid
        {
            get; set;
        }
    }

    public class CMDLog_List_Params
    {
        public string mchid { get; set; }

        public string starttime { get; set; }

        public string endtime { get; set; }

        public int? SendState { get; set; }

        public int? c_type { get; set; }
        /// <summary>
        /// 是否需要分页
        /// </summary>
        public bool? IsPage { get; set; } = true;
        /// <summary>
        ///  当前页数
        /// </summary>
        public int? page { get; set; } = 1;
        /// <summary>
        /// 单页数量
        /// </summary>

        public int? pagesize { get; set; } = 100;
    }


    public class search_my_repair_list_for_excel : Base_List_Params
    {

        /// <summary>
        /// 客户姓名
        /// </summary>
        public string user_name { get; set; }
        /// <summary>
        /// 售后ID
        /// </summary>
        public string customer_uid { get; set; }
        /// <summary>
        /// 技术售后
        /// </summary>
        public string technology_uid { get; set; }
        /// <summary>
        /// 机器类型
        /// </summary>
        public string mch_type { get; set; }
        /// <summary>
        /// 机器SN
        /// </summary>
        public string mch_sn { get; set; }
        /// <summary>
        /// 报修类型
        /// </summary>
        public string repair_type { get; set; }
        /// <summary>
        /// 报修小类型
        /// </summary>
        public string repair_kid_type { get; set; }

        /// <summary>
        /// 报修开始时间
        /// </summary>
        public string repair_sdt { get; set; }
        /// <summary>
        /// 报修结束时间
        /// </summary>
        public string repair_edt { get; set; }
        /// <summary>
        ///报修处理状态
        /// </summary>
        public int? repair_handle_state { get; set; }


        /// <summary>
        /// 处理开始时间
        /// </summary>
        public string repair_handle_endtime_sdt { get; set; }
        /// <summary>
        /// 处理结束时间
        /// </summary>
        public string repair_handle_endtime_edt { get; set; }



        /// <summary>
        /// 质保开始时间
        /// </summary>
        public string mch_assurance_sdt_sdt { get; set; }
        /// <summary>
        /// 质保结束时间
        /// </summary>
        public string mch_assurance_sdt_edt { get; set; }

        /// <summary>
        /// 审批时间
        /// </summary>
        public string repair_approval_time_sdt { get; set; }
        /// <summary>
        /// 审批结束时间
        /// </summary>
        public string repair_approval_time_edt { get; set; }

        /// <summary>
        /// 审批人
        /// </summary>
        public string approval_uid { get; set; }
        /// <summary>
        /// 审批状态
        /// </summary>
        public int? apply_state { get; set; } 

        public bool? have_express_no { get; set; }
        /// <summary>
        /// 返件类型
        /// </summary>
        public return_type? return_type { get; set; }
        /// <summary>
        /// 返件状态
        /// </summary>
        public return_approval_state? return_approval_state { get; set; }
        /// <summary>
        /// 审批次数
        /// </summary>
        public int? return_sort { get; set; }

    }


    public class search_customer_pic_for_excel : Base_List_Params
    {
        /// <summary>
        /// 客户姓名
        /// </summary>
        public string user_name { get; set; } 
        /// <summary>
        /// 机器SN
        /// </summary>
        public string mch_sn { get; set; } 
        /// <summary>
        /// 机器名称
        /// </summary>
        public string mch_name { get; set; }
        /// <summary>
        /// 提交人
        /// </summary>
        public string customer_uid { get; set; }

        public string addtime_sdt { get; set; }

        public string addtime_edt { get; set; }
    }

    public class batch_handle_apply_params
    {
        public string[] repair_ids { get; set; }

        public apply_state? state { get; set; }

        public string approval_repair_handle_result { get; set; }
    }
}
